import axios from 'axios'

// 获取列表项
export function obtainList(params) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'get',
    params
  })
}
//新增接口
export function addList(data) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'post',
    data
  })
}
//删除接口
export function deleteList(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: 'delete'
  })
}
//编辑接口
export function editorList(data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: 'put',
    data
  })
}
//详情接口
export function detailsList(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`
  })
}
//搜索接口
export function searchList(name) {
  return axios({
    url: `http://localhost:3001/data/?name=${name}`
  })
}